package com.first;

import com.first.pojo.entity.User;
import com.first.server.mapper.UserMapper;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

@SpringBootTest
class test {

    @Autowired
    private UserMapper userMapper;

    @Test
    void testInsert() {
        User user = new User();
        user.setName("Lucy");
        user.setPassword("123");
        user.setPhone("18688990011");
        user.setCreateTime(LocalDate.from(LocalDateTime.now()));
        userMapper.insert(user);
    }

    @Test
    void testSelectById() {
        User user = userMapper.selectById(5L);
        System.out.println("user = " + user);
    }

    @Test
    void testSelectByIds() {
        List<User> users = userMapper.selectBatchIds(Arrays.asList(1L, 2L, 3L, 4L, 5L));
        users.forEach(System.out::println);
    }

    @Test
    void testUpdateById() {
        User user = new User();
        userMapper.updateById(user);
    }

    @Test
    void testDelete() {
        userMapper.deleteById(5L);
    }

    @Test
    void test1(){
        String str="Lanyi430323141431421ewf214eqdfcq322313fe412fcwe";
        String str1="Lanyi430323141431421ewf214eqdfcq322313fe412fcwe";
        System.out.println(str.equals(str1));
    }
}